/*
 * Toedo
 * Copyright (C) 2009-2010 J. Devauchelle and contributors.
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * version 3 as published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 */

package org.toedo.preferences.pages;

import org.eclipse.jface.preference.ComboFieldEditor;
import org.eclipse.jface.preference.FieldEditorPreferencePage;
import org.eclipse.jface.preference.IntegerFieldEditor;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.widgets.Label;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchPreferencePage;
import org.toedo.gui.translations.Messages;
import org.toedo.preferences.PreferenceConstants;
import org.toedo.Activator;

public class ProjectDefaultsPage extends FieldEditorPreferencePage implements
		IWorkbenchPreferencePage {

	public ProjectDefaultsPage() {
		super(GRID);
		setPreferenceStore(Activator.getDefault().getPreferenceStore());
		setDescription(Messages.ProjectDefaultsPage_Description);
	}

	@Override
	protected void createFieldEditors() {
		
		Label sectionLabel;		
		sectionLabel = new Label(getFieldEditorParent(), SWT.NONE);
		sectionLabel.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, false, 2, 1));
		
		addField(new ComboFieldEditor(
				PreferenceConstants.PROJECT_DEFAULT_WIKI_MARKUP,
				Messages.ProjectDefaultsPage_DefaultWikiMarkup,
				new String[][] { { "Textile", "Textile" }, //$NON-NLS-1$ //$NON-NLS-2$
						{ "Mediawiki", "Mediawiki" }, //$NON-NLS-1$ //$NON-NLS-2$
						{ "Trac", "Trac" }, //$NON-NLS-1$ //$NON-NLS-2$
						{ "Confluence", "Confluence"} }, //$NON-NLS-1$ //$NON-NLS-2$
				getFieldEditorParent()));
		
		sectionLabel = new Label(getFieldEditorParent(), SWT.NONE);
		sectionLabel.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, false, 2, 1));
		
		addField(new IntegerFieldEditor(PreferenceConstants.PROJECT_DEFAULT_START_DATE_DELAY,
				Messages.ProjectDefaultsPage_DefaultStartDateDelay,
				getFieldEditorParent()));
		
		addField(new IntegerFieldEditor(PreferenceConstants.PROJECT_DEFAULT_TASK_DURATION,
				Messages.ProjectDefaultsPage_DefaultDuration,
				getFieldEditorParent()));
		
		addField(new IntegerFieldEditor(PreferenceConstants.PROJECT_DEFAULT_URGENT_DELAY,
				Messages.ProjectDefaultsPage_DefaultUrgentDelay,
				getFieldEditorParent()));
		
		addField(new IntegerFieldEditor(PreferenceConstants.PROJECT_DEFAULT_TASK_PRIORITY,
				Messages.ProjectDefaultsPage_DefaultPriority,
				getFieldEditorParent()));
	}

	@Override
	public void init(IWorkbench workbench) {
		// TODO Auto-generated method stub
		
	}

	
}
